﻿using Api.Core.IRepository.User;
using Api.Core.IServices.User;
using Api.Core.Model;
using Api.Core.Model.Role;
using System;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace Api.Core.Services.User
{
    public class RoleInfoService : BaseService<RoleEntity>, IRoleInfoService
    {
        public RoleInfoService(IRoleRepository roleRepository)
        {
            base.BaseDal = roleRepository;
        }



        public async Task<PageModel<RoleEntity>> GetRole(RoleDto roleDto)
        {
            Expression<Func<RoleEntity, bool>> whereExpression = a => a.RoleName.Contains(roleDto.RoleName);

            var roleModel = await base.QueryPage(
                whereExpression,
                roleDto.pageIndex,
                roleDto.pageSize,
                null);
            return roleModel;
        }
    }
}
